//  Hello World server

#include <zmq.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>

int main (void)
{
    //  Socket to talk to clients
    void *context = zmq_ctx_new ();
    void *responder = zmq_socket (context, ZMQ_REP);
    int rc = zmq_bind (responder, "ipc://test");
    assert (rc == 0);
    int count=0;
    void *watch;
    unsigned long elapsed;
    watch = zmq_stopwatch_start ();
    while (1) {
        char buffer [10];
        zmq_recv (responder, buffer, 10, 0);
        count++;
	if(count>=1000000){
		break;	
	}
        //sleep (1);          //  Do some 'work'
        zmq_send (responder, "World", 5, 0);
    }
    elapsed = zmq_stopwatch_stop (watch); 
    printf("%d,%f",count,(double) elapsed);
    return 0;
}
